<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\backend\controller;
use \tpfcore\Core;
use think\facade\Session;
use app\common\controller\ControllerBase;

/**
 * Admin控制器基类
 */
class User extends AdminBase
{
	/*
		会员管理
	*/
	public function index(){
		return $this->fetch("index",[
            'list'=>Core::loadModel($this->name)->getUserList()
        ]);
	}

	/*
		添加用户
	*/
	public function adduser(){
		/*echo "<pre/>";
		print_r(Config::get('user_level'));*/
		IS_POST && $this->jump(Core::loadModel($this->name)->adduser($this->param));
        return $this->fetch('adduser',[
        	'listLevel'=>Config::get('user_level')
        ]);
	}

	/*
		个人信息
	*/
	public function userinfo(){
		IS_POST && $this->jump(Core::loadModel($this->name)->upUserInfo($this->param));
        return $this->fetch('userinfo',['list'=>Core::loadModel($this->name)->getInfo(['id'=>\think\Session::get("backend_author_sign")['userid']])]);
	}
	
	/*
		拉黑用户操作
	*/
	public function ban(){
		$this->jump(Core::loadModel($this->name)->ban($this->param));
	}
}